<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Function call</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../boost_typeerasure/reference.html#doxygen.call_8hpp" title="Header &lt;boost/type_erasure/call.hpp&gt;">
<link rel="prev" href="structboost_1_1type__erasure_1_1typeid__.html" title="Struct template typeid_">
<link rel="next" href="structboost_1_1type__erasure_1_1callable.html" title="Struct template callable">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="structboost_1_1type__erasure_1_1typeid__.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost_typeerasure/reference.html#doxygen.call_8hpp"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="structboost_1_1type__erasure_1_1callable.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="doxygen.call_8hpp_1ada936200580091243a2b990891c80739"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Function call</span></h2>
<p>boost::type_erasure::call</p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../boost_typeerasure/reference.html#doxygen.call_8hpp" title="Header &lt;boost/type_erasure/call.hpp&gt;">boost/type_erasure/call.hpp</a>&gt;

</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Concept<span class="special">,</span> <span class="keyword">typename</span> Op<span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> U<span class="special">&gt;</span> 
  <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <span class="identifier">call</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="classboost_1_1type__erasure_1_1binding.html" title="Class template binding">binding</a><span class="special">&lt;</span> <span class="identifier">Concept</span> <span class="special">&gt;</span> <span class="special">&amp;</span> binding<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Op</span> <span class="special">&amp;</span><span class="special">,</span> 
                   <span class="identifier">U</span> <span class="special">&amp;&amp;</span><span class="special">...</span> args<span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Op<span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> U<span class="special">&gt;</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <span class="identifier">call</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Op</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">&amp;&amp;</span><span class="special">...</span> args<span class="special">)</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.39.13.7.3.4"></a><h2>Description</h2>
<p>Dispatches a type erased function.</p>
<p><code class="computeroutput">Op</code> must be a primitive concept which is present in <code class="computeroutput">Concept</code>. Its signature determines how the arguments of  <code class="computeroutput"><a class="link" href="call_8hpp_1ada936200580091243a2b990891c80739.html" title="Function call">call</a></code> are handled. If the argument is a <a class="link" href="structboost_1_1type__erasure_1_1placeholder.html" title="Struct placeholder">placeholder</a>,  <code class="computeroutput"><a class="link" href="call_8hpp_1ada936200580091243a2b990891c80739.html" title="Function call">call</a></code> expects an <a class="link" href="classboost_1_1type__erasure_1_1any.html" title="Class template any">any</a> using that <a class="link" href="structboost_1_1type__erasure_1_1placeholder.html" title="Struct placeholder">placeholder</a>. This <a class="link" href="classboost_1_1type__erasure_1_1any.html" title="Class template any">any</a> is unwrapped by  <code class="computeroutput"><a class="link" href="call_8hpp_1ada936200580091243a2b990891c80739.html" title="Function call">call</a></code>. The type that it stores must be the same type specified by <code class="computeroutput">binding</code>. Any arguments that are not placeholders in the signature of <code class="computeroutput">Op</code> are passed through unchanged.</p>
<p>If <code class="computeroutput">binding</code> is not specified, it will be deduced from the arguments. Naturally this requires at least one argument to be an <a class="link" href="classboost_1_1type__erasure_1_1any.html" title="Class template any">any</a>. In this case, all <a class="link" href="classboost_1_1type__erasure_1_1any.html" title="Class template any">any</a> arguments must have the same <a class="link" href="classboost_1_1type__erasure_1_1binding.html" title="Class template binding">binding</a>.</p>
<p>

Example:</p>
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span>
  <a class="link" href="structboost_1_1type__erasure_1_1copy__constructible.html" title="Struct template copy_constructible"><span class="identifier">copy_constructible</span><span class="special">&lt;</span><span class="identifier">_b</span><span class="special">&gt;</span></a><span class="special">,</span>
  <a class="link" href="structboost_1_1type__erasure_1_1addable.html" title="Struct template addable"><span class="identifier">addable</span><span class="special">&lt;</span><span class="identifier">_a</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">_b</span><span class="special">&gt;</span></a> <span class="special">&gt;</span> <span class="identifier">concept</span><span class="special">;</span>
<a class="link" href="classboost_1_1type__erasure_1_1any.html" title="Class template any"><span class="identifier">any</span><span class="special">&lt;</span><span class="identifier">concept</span><span class="special">,</span> <span class="identifier">_a</span><span class="special">&gt;</span></a> <span class="identifier">a</span> <span class="special">=</span> <span class="special">...</span><span class="special">;</span>
<a class="link" href="classboost_1_1type__erasure_1_1any.html" title="Class template any"><span class="identifier">any</span><span class="special">&lt;</span><span class="identifier">concept</span><span class="special">,</span> <span class="identifier">_b</span><span class="special">&gt;</span></a> <span class="identifier">b</span><span class="special">(</span><span class="identifier">call</span><span class="special">(</span><a class="link" href="structboost_1_1type__erasure_1_1addable.html" title="Struct template addable"><span class="identifier">addable</span><span class="special">&lt;</span><span class="identifier">_a</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">_b</span><span class="special">&gt;</span></a><span class="special">(</span><span class="special">)</span><span class="special">,</span> <span class="identifier">a</span><span class="special">,</span> <span class="number">10</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
</pre>
<p>The signature of <a class="link" href="structboost_1_1type__erasure_1_1addable.html" title="Struct template addable">addable</a> is <code class="computeroutput">_b(const _a&amp;, const int&amp;)</code> </p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>The result of the operation. If the result type of the signature of <code class="computeroutput">Op</code> is a placeholder, the result will be converted to the appropriate <a class="link" href="classboost_1_1type__erasure_1_1any.html" title="Class template any">any</a> type.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>
<a class="link" href="../boost/bad_function_call.html" title="Class bad_function_call">bad_function_call</a> if <a class="link" href="structboost_1_1type__erasure_1_1relaxed.html" title="Struct relaxed">relaxed</a> is in <code class="computeroutput">Concept</code> and there is a type mismatch.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="copyright-footer">Copyright © 2011-2013 Steven Watanabe<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="structboost_1_1type__erasure_1_1typeid__.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost_typeerasure/reference.html#doxygen.call_8hpp"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="structboost_1_1type__erasure_1_1callable.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
